﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ValidateControls : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RangeValidator1.MaximumValue = DateTime.Today.AddYears(-18).ToShortDateString();
    }
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
        args.IsValid = fullNameText.Text.Length > 5;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Validate();

        if (IsValid)
        {
            Response.Write("Đã insert");
        }
    }
}